<link rel="stylesheet" href="/assets/home/css/comment.css">


<img src="{$info.thumbs}" style="width:100%;height: 240px;object-fit: cover;">
<div class="weui-cells__title" style="font-size:16px;">{$info.title}</div>
<form method="post">
    <div class="weui-cells weui-cells_form">
        <div class="weui-cell">
            <div class="weui-cell__bd">
                <textarea maxlength="200" class="weui-textarea" placeholder="请输入内容" id="comment_text" name="content"
                    rows="3"></textarea>
                <div class="weui-textarea-counter"><span id="jiShu">0</span>/200</div>
            </div>
        </div>
    </div>
    <div class="weui-btn-area">
        <button type="submit" class="weui-btn weui-btn_primary">立即提交</button>
    </div>
</form>



<script>
    $("#comment_text").keypress(function (e) {
        let content = $(this).val();
        let len = content.length + 1;
        if (len >= 200) {
            content.length = 200
            $(this).val(content);
            $("#jiShu").text(200);
        } else {
            $("#jiShu").text(len);
        }
    })

    $("#comment_text").keydown(function (e) {
        if (e.keyCode == 8 || e.keyCode == 46) {
            let len = $(this).val().length - 1;
            if (len < 0) len = 0;
            $("#jiShu").text(len);
        }
    })

</script>